﻿<%@page pageEncoding="utf-8"%>
<%@include file="/util/tag.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@include file="../common/head.jsp"%>
<script language="javascript" type="text/javascript">
            //删除
            function deleteAccount(id) {
                var r = window.confirm("确定要删除此账务账号吗？\r\n删除后将不能恢复，且会删除其下属的所有业务账号。");
                if(!r)	return;
                var b = request('delete?id='+id,'删除成功，且已删除其下属的业务账号！','删除失败!数据并发错误。',$("#operate_msg"));
                if(!b){
                	$("#operate_result_info").attr("class","operate_fail");
                	}
                document.getElementById("operate_result_info").style.display = "block";
            }
            //开通或暂停
            function setStateOn(id) {
                var r = window.confirm("确定要开通此账务账号吗？");
                if(!r)	return;
                var b = request('state?status=0&id='+id,'开通成功！','开通失败!数据并发错误。',$("#operate_msg"));
                if(!b){
                	$("#operate_result_info").attr("class","operate_fail");
                	}
                document.getElementById("operate_result_info").style.display = "block";
            }
            function setStateDown(id) {
                var r = window.confirm("确定要暂停此账务账号吗？");
                if(!r)	return;
                var b = request('state?status=1&id='+id,'暂停成功，且已暂停其下属的业务账号！','暂停失败!数据并发错误。',$("#operate_msg"));
                if(!b){
                	$("#operate_result_info").attr("class","operate_fail");
                	}
            document.getElementById("operate_result_info").style.display = "block";
            }
            function search(){
            	var url="list?"+$("#idcardNo").serialize()+'&'+
            	$('#realName').serialize()+"&"+
            	$("#loginName").serialize()+"&"+
            	$("#status").serialize();
            	location.href=url;
            }
        </script>
<body>
	<%@include file="../common/top.jsp"%>

	<div id="main">
		<s:form theme="simple">
			<!--查询-->
			<div class="search_add">
				<div>
					身份证：<input name="shidcardNo" value="${shidcardNo}" id="idcardNo"
						class="text_search" />
				</div>
				<div>
					姓名：<input name="shrealName" value="${shrealName}" id="realName"
						class="width70 text_search" />
				</div>
				<div>
					登录名：<input name="shloginName" value="${shloginName}" id="loginName"
						class="text_search" />
				</div>
				<div>
					状态：
					<s:select list="#{'':'全部','0':'开通','1':'暂停','2':'删除'}"
						cssClass="select_search" name="shstatus" id="status"></s:select>

				</div>
				<div>
					<input type="button" value="搜索" class="btn_search"
						onclick="search();" />
				</div>
				<input type="button" value="增加" class="btn_add"
					onclick="location.href='toAdd?shidcardNo=${shidcardNo }&shrealName=${shrealName }&shloginName=${shloginName}&shstatus=${shstatus}&page=${page}';" />
			</div>
			<!--删除等的操作提示-->
			<div id="operate_result_info" class="operate_success">
				<img src="../images/close.png"
					onclick="this.parentNode.style.display='none';location.reload();" />
				<span id="operate_msg">删除成功，且已删除其下属的业务账号！</span>
			</div>
			<!--数据区域：用表格展示数据-->
			<div id="data">
				<table id="datalist">
					<tr>
						<th>账号ID</th>
						<th>姓名</th>
						<th class="width150">身份证</th>
						<th>登录名</th>
						<th>状态</th>
						<th class="width100">创建日期</th>
						<th class="width150">上次登录时间</th>
						<th class="width200"></th>
					</tr>
					<s:iterator value="accountList">
						<tr>
							<td>${id}</td>
							<td><a
								href="detail?id=${id}&shidcardNo=${shidcardNo }&shrealName=${shrealName }&shloginName=${shloginName}&shstatus=${shstatus}&page=${page}">
									${realName}</a></td>
							<td>${idcardNo}</td>
							<td>${loginName}</td>
							<td>${statusOptions[status]}</td>
							<td>${createDate}</td>
							<td>${lastLoginTime}</td>
							<td class="td_modi"><s:if test="status!=2">
									<s:if test="status==0">
										<input type="button" value="暂停" class="btn_pause"
											onclick="setStateDown(${id});" />
									</s:if>
									<s:else>
										<input type="button" value="开通" class="btn_start"
											onclick="setStateOn(${id});" />
									</s:else>
									<input type="button" value="修改" class="btn_modify"
										onclick="location.href='toUpdate?id=${id}&shidcardNo=${shidcardNo }&shrealName=${shrealName }&shloginName=${shloginName}&shstatus=${shstatus}&page=${page}';" />
									<input type="button" value="删除" class="btn_delete"
										onclick="deleteAccount(${id});" />
								</s:if></td>
						</tr>
					</s:iterator>
				</table>
				<p>
					业务说明：<br /> 1、创建则开通，记载创建时间；<br /> 2、暂停后，记载暂停时间；<br />
					3、重新开通后，删除暂停时间；<br /> 4、删除后，记载删除时间，标示为删除，不能再开通、修改、删除；<br />
					5、暂停账务账号，同时暂停下属的所有业务账号；<br />
					6、暂停后重新开通账务账号，并不同时开启下属的所有业务账号，需要在业务账号管理中单独开启；<br />
					7、删除账务账号，同时删除下属的所有业务账号。
				</p>
			</div>
			<!--分页-->
			<div id="pages">
				<a
					href="?shidcardNo=${shidcardNo }&shrealName=${shrealName }&shloginName=${shloginName}&shstatus=${shstatus}&page=1">首页</a>
				<s:if test="page>1">
					<a
						href="?shidcardNo=${shidcardNo }&shrealName=${shrealName }&shloginName=${shloginName}&shstatus=${shstatus}&page=${page-1}">上一页</a>
				</s:if>
				<s:else>
					<a>上一页</a>
				</s:else>
				<s:iterator begin="1" end="pageCount" var="i">
					<a
						href="?shidcardNo=${shidcardNo }&shrealName=${shrealName }&shloginName=${shloginName}&shstatus=${shstatus}&page=${i}"
						<c:if test="${page==i}">class="current_page"</c:if>>${i}</a>
				</s:iterator>
				<s:if test="page<pageCount">
					<a
						href="?shidcardNo=${shidcardNo }&shrealName=${shrealName }&shloginName=${shloginName}&shstatus=${shstatus}&page=${page+1}">下一页</a>
				</s:if>
				<s:else>
					<a>下一页</a>
				</s:else>
				<a
					href="?shidcardNo=${shidcardNo }&shrealName=${shrealName }&shloginName=${shloginName}&shstatus=${shstatus}&page=${pageCount}">末页</a>
			</div>
		</s:form>
	</div>

	<%@include file="../common/bottom.jsp"%>
</body>
</html>
